using Glue;
using Glue.Converters;
using Glue.Internals;
using GlueTests.Builders;
using Xunit;

namespace GlueTests.ConverterContainerTests
{
    public class When_adding_a_converter_between_same_type
    {
        private readonly IConverter boolConverter;
        private readonly ConverterContainer converters;

        public When_adding_a_converter_between_same_type()
        {
            boolConverter = Converting.ToNegatedBoolean();
            converters = new ConverterContainer();
            converters.Add(boolConverter);
        }

        [Fact]
        public void Should_override_default_SameTypeMapping()
        {
            var boolProperty = PropertyBuilder.AsBooleanProperty().Build();
            var converter = converters.Get(boolProperty, boolProperty,RelationDirection.TwoWays);
            Assert.Same(boolConverter,converter);
        }
    }
}